package com.wl2o2o.lanqiao.xzfourteen;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

/**
 * 例题：最小质因子之和
		题目链接：最小质因子之和(Easy Version) - 蓝桥云课 (lanqiao.cn)
 * @author WLei224
 *
 */

public class MinPrimeSum{
    // 用于存放是否为素数
    static boolean[] isprime = new boolean[3001];
    // 方最小质因子
    static long[] ans = new long[3001];
    static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) throws NumberFormatException, IOException{
        //先获取最小质因子，然后通过循环来计算前缀和
        get(3000);
        // long N = Integer.paraseInt(in.read());
        for(int i = 2; i < 3000; i++){
            ans[i] = ans[i] + ans[i-1];
        }
        int n = Integer.parseInt(in.readLine());
        while(n-->0) {
            out.println(ans[Integer.parseInt(in.readLine())]);
        }
        out.flush();

    }

    //用于获得知晓质因子，然后放在ans中
    public static void get(int n){
        for(int i = 2; i <= n; i++){
            if(isprime[i]) {
                continue;
            }
            ans[i] = i;
            for(int j = 2; j < n/i; j++){
                if(isprime[i*j]){
                    isprime[i*j] = true;
                    ans[i*j] = i;
                }
            }
        }
    } 
}